package com.ruoyi.resume.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.resume.domain.BoleResumeSkills;
import com.ruoyi.resume.service.IBoleResumeSkillsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 简历技能Controller
 * 
 * @author wujiale
 * @date 2025-08-04
 */
@RestController
@RequestMapping("/resume/skills")
public class BoleResumeSkillsController extends BaseController
{
    @Autowired
    private IBoleResumeSkillsService boleResumeSkillsService;

    /**
     * 查询简历技能列表
     */
    @PreAuthorize("@ss.hasPermi('resume:skills:list')")
    @GetMapping("/list")
    public TableDataInfo list(BoleResumeSkills boleResumeSkills)
    {
        startPage();
        List<BoleResumeSkills> list = boleResumeSkillsService.selectBoleResumeSkillsList(boleResumeSkills);
        return getDataTable(list);
    }

    /**
     * 导出简历技能列表
     */
    @PreAuthorize("@ss.hasPermi('resume:skills:export')")
    @Log(title = "简历技能", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BoleResumeSkills boleResumeSkills)
    {
        List<BoleResumeSkills> list = boleResumeSkillsService.selectBoleResumeSkillsList(boleResumeSkills);
        ExcelUtil<BoleResumeSkills> util = new ExcelUtil<BoleResumeSkills>(BoleResumeSkills.class);
        util.exportExcel(response, list, "简历技能数据");
    }

    /**
     * 获取简历技能详细信息
     */
    @PreAuthorize("@ss.hasPermi('resume:skills:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(boleResumeSkillsService.selectBoleResumeSkillsById(id));
    }

    /**
     * 新增简历技能
     */
    @PreAuthorize("@ss.hasPermi('resume:skills:add')")
    @Log(title = "简历技能", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BoleResumeSkills boleResumeSkills)
    {
        return toAjax(boleResumeSkillsService.insertBoleResumeSkills(boleResumeSkills));
    }

    /**
     * 修改简历技能
     */
    @PreAuthorize("@ss.hasPermi('resume:skills:edit')")
    @Log(title = "简历技能", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BoleResumeSkills boleResumeSkills)
    {
        return toAjax(boleResumeSkillsService.updateBoleResumeSkills(boleResumeSkills));
    }

    /**
     * 删除简历技能
     */
    @PreAuthorize("@ss.hasPermi('resume:skills:remove')")
    @Log(title = "简历技能", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(boleResumeSkillsService.deleteBoleResumeSkillsByIds(ids));
    }
}
